﻿namespace HiMap.Style
{
    using HiMap.Base;
    using System;
    using System.Drawing;
    using System.Text;

    public class PointSymbolFontClass : PointSymbolClass, IPointSymbolFont, IPointSymbol, IHiMapPtr
    {
        public PointSymbolFontClass(int InPtr, bool Used)
        {
            base.m_InPtr = InPtr;
            base.m_Used = Used;
        }

        public PointSymbolFontClass(StringBuilder fontname, int charno)
        {
            base.m_InPtr = VC.KWG_POINTSYMBOLFONT_CREATE(fontname, charno);
            base.m_Used = false;
        }

        public int Angle
        {
            get
            {
                return VC.KWG_POINTSYMBOLFONT_GET_ANGLE(base.m_InPtr);
            }
            set
            {
                VC.KWG_POINTSYMBOLFONT_SET_ANGLE(base.m_InPtr, value);
            }
        }

        public System.Drawing.Color Color
        {
            get
            {
                int num = VC.KWG_POINTSYMBOLFONT_GET_COLOR(base.m_InPtr);
                int red = num % 0x100;
                int green = (num % 0x10000) / 0x100;
                int blue = num / 0x10000;
                return System.Drawing.Color.FromArgb(red, green, blue);
            }
            set
            {
                int color = (value.R + (value.G * 0x100)) + ((value.B * 0x100) * 0x100);
                VC.KWG_POINTSYMBOLFONT_SET_COLOR(base.m_InPtr, color);
            }
        }

        public int FontIndex
        {
            get
            {
                return VC.KWG_POINTSYMBOLFONT_GET_FONTINDEX(base.m_InPtr);
            }
        }

        public string FontName
        {
            get
            {
                StringBuilder fontname = new StringBuilder(0xff);
                if (!VC.KWG_POINTSYMBOLFONT_GET_FONTNAME(base.m_InPtr, fontname))
                {
                    return "";
                }
                return fontname.ToString();
            }
        }

        public int OffsetX
        {
            get
            {
                return VC.KWG_POINTSYMBOLFONT_GET_OFFSETX(base.m_InPtr);
            }
            set
            {
                VC.KWG_POINTSYMBOLFONT_SET_OFFSETX(base.m_InPtr, value);
            }
        }

        public int OffsetY
        {
            get
            {
                return VC.KWG_POINTSYMBOLFONT_GET_OFFSETY(base.m_InPtr);
            }
            set
            {
                VC.KWG_POINTSYMBOLFONT_SET_OFFSETY(base.m_InPtr, value);
            }
        }

        public int Size
        {
            get
            {
                return VC.KWG_POINTSYMBOLFONT_GET_SIZE(base.m_InPtr);
            }
            set
            {
                VC.KWG_POINTSYMBOLFONT_SET_SIZE(base.m_InPtr, value);
            }
        }
    }
}

